@@ -1,8 +1,11 @@ |
||
| 1 | 1 |
class AddEventIdAtCreationToLinks < ActiveRecord::Migration |
| 2 |
+ class Link < ActiveRecord::Base; end |
|
| 3 |
+ class Event < ActiveRecord::Base; end |
|
| 4 |
+ |
|
| 2 | 5 |
def up |
| 3 | 6 |
add_column :links, :event_id_at_creation, :integer, :null => false, :default => 0 |
| 4 | 7 |
|
| 5 |
- Link.all.each do |link| |
|
| 8 |
+ Link.all.find_each do |link| |
|
| 6 | 9 |
last_event_id = execute( |
| 7 | 10 |
<<-SQL |
| 8 | 11 |
SELECT #{ActiveRecord::Base.connection.quote_column_name('id')}
|